public class test {
    // 游戏(单调队列⭐⭐)
    public class Main {
        public static int N = 100005;
        public static int[] arr;
        public static int[] max;//熊大
        public static int[] min;//熊二
        public static Deque<Integer> queue;
        public static void main(String[] args) {
            Scanner in = new Scanner(System.in);
            int sum = 0;
            int n = in.nextInt();
            int k = in.nextInt();
            arr = new int[N];
            max = new int[N];
            min = new int[N];
            for(int i = 1;i <= n;i++) {
                arr[i] = in.nextInt();
            }
            queue = new ArrayDeque<>();
            fillDeque(1, n, k);
            queue.clear();
            fillDeque(2, n, k);
            int num = n - k + 1;
            long Sum = 0;
            for(int i = 0;i < num;i++){
                Sum += (max[i] - min[i]);
            }
            System.out.printf("%.2f",1.0 * Sum / num);
        }
        //熊大 -> 1 单调递减队列
        //熊二 -> 2 单调递增队列
        public static void fillDeque(int bear,int n,int k) {
            for(int i = 1;i <= n;i++) {
                // 1. 队列不为空
                // 2. 滑动窗口不能溢出
                if(!queue.isEmpty() && queue.peekFirst() == i - k) {
                    queue.pollFirst();
                }
                if(bear == 1) {
                    while(!queue.isEmpty() && arr[queue.peekLast()] <= arr[i]) {
                        queue.pollLast();
                    }
                    queue.add(i);
                    if(i >= k) {
                        max[i - k] = arr[queue.peekFirst()];
                    }
                }else {
                    while(!queue.isEmpty() && arr[queue.peekLast()] >= arr[i]) {
                        queue.pollLast();
                    }
                    queue.add(i);
                    if(i >= k) {
                        min[i - k] = arr[queue.peekFirst()];
                    }
                }
            }
        }
    }
    //获取窗口最大/最小值(⭐⭐)
    public class Main2 {
        public static int N = 100005;
        public static int[] arr;
        public static void main(String[] args) {
            Scanner in = new Scanner(System.in);
            int n = in.nextInt();
            int k = in.nextInt();
            arr = new int[N];
            for(int i = 0;i < n;i++) {
                arr[i] = in.nextInt();
            }
            // 1. 滑动窗口中的最小值 -> 单调递增队列
            Deque<Integer> queue = new ArrayDeque<>();
            for(int i = 0;i < n;i++) {
                // 保证窗口内数据大小不超过规定范围k
                if(!queue.isEmpty() && queue.peekFirst() == i - k) {
                    queue.pollFirst();
                }
                while(!queue.isEmpty() && arr[queue.peekLast()] >= arr[i]) {
                    queue.pollLast();
                }
                queue.add(i);
                if(i >= k - 1) {
                    //System.out.print(queue.toString() + " ");
                    System.out.print(arr[queue.peekFirst()] + " ");
                }
            }
            System.out.println();
            // 2. 滑动窗口中的最大值 -> 单调递减队列
            queue.clear();
            for(int i = 0;i < n;i++) {
                if(!queue.isEmpty() && queue.peekFirst() == i - k) {
                    queue.pollFirst();
                }
                while(!queue.isEmpty() && arr[queue.peekLast()] <= arr[i]) {
                    queue.pollLast();
                }
                queue.add(i);
                if(i >= k - 1) {
                    //System.out.print(queue.toString() + " ");
                    System.out.print(arr[queue.peekFirst()] + " ");
                }
            }
        }
    }
}
